<extend name="work/base"/>
<block name="content">
    <div>
        <div class="layui-container">
            <table class="layui-table">
                <tbody>
                <tr>
                    <td colspan="2"><img src="{$info.face}" class="face"></td>
                </tr>
                <tr>
                    <td>用户名称</td>
                    <td>{$info.nickname}</td>
                </tr>
                <tr>
                    <td>项目</td>
                    <td>{:config('param.web_name')}</td>
                </tr>
                <tr>
                    <td colspan="2"><button type="button" class="layui-btn  layui-btn-lg layui-btn-normal" id="authweb">
                        授权绑定{:config('param.web_name')}
                    </button></td>
                </tr>
                </tbody>
            </table>


        </div>
        <div class="layui-container">
            <div class="layui-card">
                <div class="layui-card-header">提示：</div>
                <div class="layui-card-body">
                    你同意授权绑定后将收到对应项目信息<br>
                    绑定后你不能在这里取消绑定
                </div>
            </div>

        </div>
    </div>
    <style>
        .face {
            width: 200px;
            margin: 30px;
            display: inline-block;

        }
        .layui-container {
            text-align: center;
            width: 100%;
            background-color: #d2d2d2;
            padding:10px;
        }

        body {
            background-color: #d2d2d2;
        }

        .layui-card {
            text-align: left;
        }
        .layui-btn {
            margin: 30px;
        }
    </style>

</block>
<block name="script">
    <script type="text/javascript">
        layui.use(['form', 'layer', 'table'], function () {
            var form = layui.form
                , $ = layui.$;


            $('#authweb').click(function () {

                $.ajax({
                    url: "{:url('index')}",
                    type: 'post',
                    dataType: 'json',
                    data: {
                        token: '{$token}'
                    }
                })
                    .done(function (res) {
                        if (res.code == 0) {
                            layer.msg(res.msg, {
                                time: 0,
                                icon: 5,
                                anim: 5,
                                shadeClose:false,
                                shade: [0.8, '#393D49']
                            });
                        } else {
                            layer.msg(res.msg, {
                                time: 0,
                                icon: 1,
                                anim: 5,
                                shadeClose:false,
                                shade: [0.8, '#393D49']
                            });
                        }
                    })
                    .fail(function () {
                        layer.msg('服务器异常', {
                            time: 1500,
                            icon: 5
                        });
                    })
                    .always(function () {

                    });
            });

        });

    </script>
</block>
